import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by dell on 2017/8/7.
 */
public class FileWriteTest {
    public static void main(String[] args) throws IOException {
        try (
                FileWriter fw = new FileWriter("newWrite.txt")) {
            fw.write("遇见-孙燕姿\r\n");
            fw.write("阴天，傍晚，车窗外\r\n");
            fw.write("未来有一个人在等待\r\n我想，我等，我期待\r\n未来却不能因此安排\r\n");
        } catch (IOException e) {
            e.printStackTrace();
        }
        try (

                FileReader fr = new FileReader("newWrite.txt");
                FileWriter fw = new FileWriter("newGetWrite.txt")) {
            char[] ch = new char[32];
            int hasRead = 0;
            while ((hasRead = fr.read(ch)) > 0) {
                //System.out.println(new String(ch,0,hasRead));
                fw.write(ch, 0, hasRead);
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }

    }
}
